<!-- Page Title Start -->
<style>
  #imgbox{
    margin: 20px auto;
    width:100px;
    height:100px;
    background-size: cover;
  <? if(!empty($_SESSION['loginPic'])){ ?>
    background-image:url(../../uploads/userpic/<?=$_SESSION['loginPic'] ?>);
    <?}else{ ?>
         background-image:url(../../static/image/addpic.png);
         <?} ?>
  }
  #imgbox:hover{
    background-image:url(../../static/image/addpic.png);
    background-color: #fff;
  }
  #editupic{
    cursor:pointer;
    width:100px;
    height:100px;
    opacity:0;
  }
</style>

<div class="row">
  <div class="colxl-12 col-lg-12 col-md-12 col-sm-12 col-12">
    <div class="page-title-wrapper">
      <div class="page-title-box">
        <h4 class="page-title bold">个人信息</h4>
      </div>
    </div>
  </div>
</div>
<div class="card-content">
  <div class="card-body">
    <div class="mfh-machine-profile">
      <ul class="nav nav-tabs" id="myTab1" role="tablist">
        <li class="nav-item">
          <a class="nav-link <?=$_GET['action']==editBaseInfo||$_GET['action']==null ? 'active':'' ?> " id="home-tab1" data-toggle="tab" href="#home0" role="tab" aria-controls="home" aria-selected="true">修改信息</a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?=$_GET['action']==editPWDInfo ? 'active':'' ?> " id="profile-tab2" data-toggle="tab" href="#profile0" role="tab" aria-controls="profile" aria-selected="false">修改密码</a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?=$_GET['action']==editPicInfo ? 'active':'' ?> " id="profile-tab3" data-toggle="tab" href="#messages" role="tab" aria-controls="profile" aria-selected="false">修改头像</a>
        </li>
      </ul>
      <div class="tab-content ad-content2" id="myTabContent2">
        <div class="tab-pane fade <?=$_GET['action']==editBaseInfo||$_GET['action']==null ? 'show active':'' ?> " id="home0" role="tabpanel">
          <!-- Products view Start -->
          <?=baseInfoShowTips($_SESSION['baseInfoShowTips'],$_SESSION['baseInfotipsType']); ?>
          <div class="row">
            <div class="offset-xl-2 col-xl-8">
              <div class="card"><grammarly-extension data-grammarly-shadow-root="true" style="position: absolute; top: 0px; left: 0px; pointer-events: none;" class="cGcvT"></grammarly-extension>
                <div class="card-header">
                  <h4 class="card-title mb-0">修改信息</h4>
                </div>
                <div class="card-body">
                  <form action="./personInfo.php?action=editBaseInfo" method="post">
                    <input type="hidden" name="id" value="<?=$_SESSION['loginId'] ?>" >
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">用户名</label>
                      <input class="form-control" placeholder="请输入新用户名(2~16位，只允许汉字，英文字母，数字，下划线)" value="<?=$_SESSION['loginName'] ?>" name="edituname">
                    </div>
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">性别</label>
                      <select class="form-control btn-square" name="editusex">
                        <?=sexSelect($sexArray,$_SESSION['loginSex']) ?>
                      </select>
                    </div>
                    <? if($_SESSION['loginIden']=='管理员'){ ?>
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">等级</label>
                      <select class="form-control btn-square" name="edituiden">
                        <?=sexSelect($idenArray,$_SESSION['loginIden']) ?>
                      </select>
                    </div>
                    <?}else{ ?>
                      <input type="hidden" value="<?=uidenRevTurn($_SESSION['loginIden']) ?>" name="edituiden" >
                    <?}?>
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">简介</label>
                      <textarea class="form-control" rows="5" maxlength="200" placeholder="请输入新简介(限200字)" spellcheck="false" name="editudesc"><?=$_SESSION['loginDesc'] ?></textarea>
                    </div>
                    <div class="form-footer text-right">
                      <input type="submit" class="btn btn-primary squer-btn" value="保 存" >
                      <input type="reset" class="btn btn-light squer-btn" value="重 置" >
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="tab-pane fade <?=$_GET['action']==editPWDInfo ? 'show active':'' ?> " id="profile0" role="tabpanel">
          <!-- Products view Start -->
          <?=pwdInfoShowTips($_SESSION['pwdInfoShowTips'],$_SESSION['pwdInfotipsType']); ?>
          <div class="row">
            <div class="offset-xl-2 col-xl-8">
              <div class="card"><grammarly-extension data-grammarly-shadow-root="true" style="position: absolute; top: 0px; left: 0px; pointer-events: none;" class="cGcvT"></grammarly-extension>
                <div class="card-header">
                  <h4 class="card-title mb-0">修改密码</h4>
                </div>
                <div class="card-body">
                  <form action="./personInfo.php?action=editPWDInfo" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="<?=$_SESSION['loginId'] ?>" >
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">旧密码</label>
                      <input class="form-control" type="password" placeholder="请输入旧密码" name="editoldupwd">
                    </div>
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">新密码</label>
                      <input class="form-control" type="password" placeholder="请输入新密码(6~16位，只允许英文字母，数字，下划线)" name="editupwd">
                    </div>
                    <div class="mb-3">
                      <label class="form-label font-weight-bold">确认新密码</label>
                      <input class="form-control" type="password" placeholder="请再次输入新密码" name="editcomupwd">
                    </div>
                    <div class="form-footer text-right">
                      <input type="submit" class="btn btn-primary squer-btn" value="保 存" >
                      <input type="reset" class="btn btn-light squer-btn" value="重 置" >
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="tab-pane fade <?=$_GET['action']==editPicInfo ? 'show active':'' ?> " id="messages" role="tabpanel">
          <!-- Products view Start -->
          <?=picInfoShowTips($_SESSION['picInfoShowTips'],$_SESSION['picInfotipsType']); ?>
          <div class="row">
            <div class="offset-xl-2 col-xl-5">
              <div class="card"><grammarly-extension data-grammarly-shadow-root="true" style="position: absolute; top: 0px; left: 0px; pointer-events: none;" class="cGcvT"></grammarly-extension>
                <div class="card-header">
                  <h4 class="card-title mb-0">修改头像</h4>
                </div>
                <div class="card-body text-center">
                  <label class="form-label font-weight-bold">点击修改当前头像</label>
                  <form action="./personInfo.php?action=editPicInfo" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="<?=$_SESSION['loginId'] ?>" >
                    <div class="media ad-profile2-img">
                      <div id="imgbox">
                        <input type="file" name="editupic" id="editupic" onchange="browseUploadImg(this)"  accept="image/*" >
                      </div>
                    </div>

                    <div class="form-footer text-right">
                      <input type="submit" class="btn btn-primary squer-btn" value="保 存" >
                      <input type="reset" class="btn btn-light squer-btn" onclick="cleanbrowseUploadImg(0)" value="重 置" >
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
</div>